/* 企业级管理系统样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* 企业级配色方案 */
    --primary-blue: #2563eb;
    --primary-blue-dark: #1e40af;
    --primary-blue-light: #3b82f6;
    --secondary-gray: #64748b;
    --success-green: #10b981;
    --warning-orange: #f59e0b;
    --danger-red: #ef4444;
    --info-cyan: #06b6d4;
    
    /* 背景色 */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --bg-header: #1e293b;
    --bg-sidebar: #0f172a;
    
    /* 文字颜色 */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --text-white: #ffffff;
    
    /* 边框和阴影 */
    --border-color: #e2e8f0;
    --border-dark: #cbd5e1;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 14px;
}

.app-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 顶部导航栏 */
.app-header {
    background: linear-gradient(135deg, var(--bg-header) 0%, #334155 100%);
    color: var(--text-white);
    padding: 0;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-section {
    display: flex;
    flex-direction: column;
}

.logo {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-white);
    margin: 0;
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
    font-weight: 400;
    letter-spacing: 0.5px;
}

.current-time {
    font-size: 13px;
    color: var(--text-light);
    font-weight: 400;
}

/* 统计面板 */
.stats-section {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 24px 30px;
}

.stats-container {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-blue-light);
}

.stat-card.alert-card {
    border-left: 4px solid var(--warning-orange);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    color: white;
}

.employees-icon {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.products-icon {
    background: linear-gradient(135deg, #10b981, #059669);
}

.warning-icon {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.expiry-icon {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

/* 主内容区 */
.main-content {
    flex: 1;
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    padding: 0;
}

/* 侧边栏 */
.sidebar {
    width: 240px;
    background: var(--bg-sidebar);
    min-height: calc(100vh - 200px);
    padding: 20px 0;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: transparent;
    border: none;
    color: var(--text-light);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-white);
}

.nav-item.active {
    background: var(--primary-blue);
    color: var(--text-white);
    box-shadow: var(--shadow-sm);
}

.nav-icon {
    font-size: 18px;
    width: 20px;
    text-align: center;
}

.nav-label {
    flex: 1;
}

/* 内容区域 */
.content-area {
    flex: 1;
    padding: 30px;
    background: var(--bg-primary);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.panel-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.btn-refresh {
    padding: 8px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-refresh:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary-blue-light);
    color: var(--primary-blue);
}

/* 面板卡片 */
.panel-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    overflow: hidden;
}

.panel-card.alert-panel {
    border-left: 4px solid var(--warning-orange);
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.warning-badge {
    background: var(--warning-orange);
    color: white;
}

.danger-badge {
    background: var(--danger-red);
    color: white;
}

.card-body {
    padding: 24px;
}

/* 表格样式 */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table thead {
    background: var(--bg-tertiary);
}

.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-color);
}

.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: top;
}

.data-table tbody tr {
    transition: background-color 0.15s ease;
}

.data-table tbody tr:hover {
    background: var(--bg-tertiary);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table .status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.warning {
    background: #fef3c7;
    color: #92400e;
}

.status-badge.danger {
    background: #fee2e2;
    color: #991b1b;
}

.status-badge.success {
    background: #d1fae5;
    color: #065f46;
}

.data-table .loading,
.data-table .empty {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-style: italic;
}

/* 表单样式 */
.form-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group .required {
    color: var(--danger-red);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

input[type="text"],
input[type="number"],
input[type="date"] {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-secondary);
    transition: all 0.2s ease;
    font-family: inherit;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="date"]:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

input::placeholder {
    color: var(--text-light);
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

/* 按钮样式 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: var(--primary-blue);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: var(--primary-blue-dark);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-dark);
}

.btn-danger-small {
    padding: 6px 12px;
    background: var(--danger-red);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-danger-small:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

.guarantor-link {
    background: none;
    border: none;
    color: var(--primary-blue);
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
    font-size: 13px;
}

.guarantor-link:hover {
    color: var(--primary-blue-dark);
}

.search-box {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* 布局网格 */
.dashboard-grid,
.panel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 24px;
}

/* 消息提示 */
.toast-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 14px 20px;
    border-radius: 6px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    max-width: 350px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast-message.show {
    transform: translateX(0);
}

.toast-message.success {
    background: var(--success-green);
    color: white;
}

.toast-message.error {
    background: var(--danger-red);
    color: white;
}

.toast-message.info {
    background: var(--info-cyan);
    color: white;
}

/* 加载遮罩 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loading-overlay.show {
    display: flex;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        min-height: auto;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .nav-menu {
        flex-direction: row;
        overflow-x: auto;
        padding: 12px;
    }
    
    .nav-item {
        white-space: nowrap;
    }
    
    .dashboard-grid,
    .panel-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .header-content {
        padding: 16px 20px;
    }
    
    .logo {
        font-size: 20px;
    }
    
    .content-area {
        padding: 20px;
    }
    
    .stats-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
    background: var(--secondary-gray);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-blue);
}
